package com.AC.ACBaidu;

import java.util.HashMap;
import java.util.Scanner;

public class test3 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        target = sc.nextInt();
        max = sc.nextInt();
        System.out.println(recur(target));
    }

    static int res, target, max;

    static int mod = 1000000007;

    static HashMap<Integer, Integer> mono = new HashMap<>();


    public static int recur(int n){
        if(n == 1)
            return  1;
        if(mono.get(n)!=null)
            return mono.get(n);
        int cur = 0;
        for(int i = 1; i<=max - 2; i++){
             cur += recur(n - i);
        }
        mono.put(n , cur);
        return mono.get(n);
    }

    public static void dfs(int curLen, int preLen, int prepreLen){
        if(preLen == prepreLen || curLen > target)
            return;
        if(curLen == target){
            res = (res + 1) % mod ;
            return;
        }

        for(int i = 1; i<=max; i++){
            if(i == preLen || prepreLen == i )
                continue;
            dfs(curLen + i, i, preLen);
        }
    }
}
